﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wimm.Common.Entities
{
    public class Transaction: BaseEntity
    {
        public Transaction()
        {
            //For SQL Light only
        }

        public Transaction(int amount, DateTime timeOfService, int userId)
            : this(amount, timeOfService.Ticks, userId)
        {
        }

        public Transaction(int amount, long timeOfService, int userId)
        {
            this.Amount = amount;
            this.UserId = userId;
            this.Time = timeOfService;
        }

        public void SetTransaction(Int32 id, Int32 amount, DateTime time, User user)
        {
            this.Id     = id;
            this.Time   = time.Ticks;
            this.Amount = amount;
            this.UserId = user == null ? -1 : user.Id;
        }

        public long Time { get; protected set; }
        public Int32 Amount { get; protected set; }
        public Int32 UserId { get; protected set; } 
    }
}
